package com.ruoyi.system.service.impl;

import java.util.List;

import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.common.utils.uuid.IdUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.system.mapper.GwStaffBaseMapper;
import com.ruoyi.system.domain.GwStaffBase;
import com.ruoyi.system.service.IGwStaffBaseService;

import javax.annotation.Resource;

/**
 * 员工信息Service业务层处理
 *
 * @author ruoyi
 * @date 2025-04-27
 */
@Service
public class GwStaffBaseServiceImpl implements IGwStaffBaseService {
    @Resource
    private GwStaffBaseMapper gwStaffBaseMapper;

    /**
     * 查询员工信息
     *
     * @param id 员工信息主键
     * @return 员工信息
     */
    @Override
    public GwStaffBase selectGwStaffBaseById(String id) {
        return gwStaffBaseMapper.selectGwStaffBaseById(id);
    }

    /**
     * 查询员工信息列表
     *
     * @param gwStaffBase 员工信息
     * @return 员工信息
     */
    @Override
    public List<GwStaffBase> selectGwStaffBaseList(GwStaffBase gwStaffBase) {
        return gwStaffBaseMapper.selectGwStaffBaseList(gwStaffBase);
    }

    /**
     * 新增员工信息
     *
     * @param gwStaffBase 员工信息
     * @return 结果
     */
    @Override
    public int insertGwStaffBase(GwStaffBase gwStaffBase) {
        gwStaffBase.setId(IdUtils.fastSimpleUUID());
        gwStaffBase.setCreateTime(DateUtils.getNowDate());
        gwStaffBase.setUpdateTime(DateUtils.getNowDate());
        return gwStaffBaseMapper.insertGwStaffBase(gwStaffBase);
    }

    /**
     * 修改员工信息
     *
     * @param gwStaffBase 员工信息
     * @return 结果
     */
    @Override
    public int updateGwStaffBase(GwStaffBase gwStaffBase) {
        gwStaffBase.setUpdateTime(DateUtils.getNowDate());
        gwStaffBase.setUpdateBy(SecurityUtils.getLoginUser().getUser().getNickName());
        return gwStaffBaseMapper.updateGwStaffBase(gwStaffBase);
    }

    /**
     * 批量删除员工信息
     *
     * @param ids 需要删除的员工信息主键
     * @return 结果
     */
    @Override
    public int deleteGwStaffBaseByIds(String[] ids) {
        return gwStaffBaseMapper.deleteGwStaffBaseByIds(ids);
    }

    /**
     * 删除员工信息信息
     *
     * @param id 员工信息主键
     * @return 结果
     */
    @Override
    public int deleteGwStaffBaseById(String id) {
        return gwStaffBaseMapper.deleteGwStaffBaseById(id);
    }

    @Override
    public void deleteByStaffId(String staffId) {
        gwStaffBaseMapper.deleteByStaffId(staffId);
    }
}
